namespace :tressaweb do
  desc 'Sends emails at email_queues table.'
  task :send_queued_emails => :environment do
    EmailQueue.all.each do |email|
      begin
        UserMailer.contact_email(email.email_from, email.email_to, email.subject, email.body).deliver
        #email.destroy
      rescue Exception => ex
        puts ex.message
      end
    end
  end
end